package com.macro.mall.model;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * pms_site实体类
 *
 * @author gaodx
 *
 */
@Data
@Builder
@AllArgsConstructor
public class PmsSite implements Serializable{
	/**主键*/
    @ApiModelProperty(value = "主键")
	private Integer id; 
	/**机构id*/
    @NotNull(message = "机构id不可为空")
    @ApiModelProperty(value = "机构id")
	private Integer deptId; 
	/**机构名称*/
    @NotBlank(message = "机构名称不可为空")
    @ApiModelProperty(value = "机构名称")
	private String deptName;
	/**场地名称*/
    @NotBlank(message = "场地名称不可为空")
    @ApiModelProperty(value = "场地名称")
	private String siteName; 
	/**场地地址*/
    @NotBlank(message = "场地地址不可为空")
    @ApiModelProperty(value = "场地地址")
	private String siteAdd; 
	/**场地描述*/
    @ApiModelProperty(value = "场地描述")
	private String siteDesc; 
	/**省*/
    @NotBlank(message = "省不可为空")
    @ApiModelProperty(value = "省")
	private String province;
	/**市*/
    @NotBlank(message = "市不可为空")
    @ApiModelProperty(value = "市")
	private String city;
    /**区*/
    @ApiModelProperty(value = "区")
    private String area;
	/**场馆照片多张以','分隔*/
    @ApiModelProperty(value = "场馆照片多张以','分隔")
	private String siteImg; 
	/**营业时间*/
    @ApiModelProperty(value = "营业时间")
	private String businessHours; 
	/**休息时间*/
    @ApiModelProperty(value = "休息时间")
	private String closingTime; 
	/**负责人*/
    @ApiModelProperty(value = "负责人")
	private String responsible; 
	/**电话*/
    @ApiModelProperty(value = "电话")
	private String phone; 
	/**固定电话*/
    @ApiModelProperty(value = "固定电话")
	private String landline; 
	/**营业许可*/
    @ApiModelProperty(value = "营业许可")
	private String license; 
	/**1-正德场馆 2-自营场馆*/
    @ApiModelProperty(value = "1-正德场馆 2-自营场馆")
	private String siteType; 
	/**经度*/
    @ApiModelProperty(value = "经度")
	private String longitude; 
	/**纬度*/
    @ApiModelProperty(value = "纬度")
	private String latitude; 
	/**01-可用 02-禁用*/
    @ApiModelProperty(value = "01-可用 02-禁用")
	private String status; 
	/**可用时间*/
    @NotNull(message = "可用时间开始不可为空")
    @ApiModelProperty(value = "可用时间")
	private Date startTime; 
	/**不可用时间*/
    @NotNull(message = "可用结束时间不可为空")
    @ApiModelProperty(value = "不可用时间")
	private Date endTime; 
	/**创建时间*/
    @ApiModelProperty(value = "创建时间")
	private Date createTime; 
	/**修改时间*/
    @ApiModelProperty(value = "修改时间")
	private Date updateTime; 
	/**
	 * 实例化
	 */
	public PmsSite() {
		super();
	}
	/**
	 * 实例化
	 * 
	 * @param obj
	 */

	public PmsSite(JSONObject obj) {
		this();
		if (obj.get("id") instanceof Number) {
			this.setId(((Number) obj.get("id")).intValue());
		}
		if (obj.get("deptId") instanceof Number) {
			this.setDeptId(((Number) obj.get("deptId")).intValue());
		}
		if (obj.get("deptName") instanceof String) {
			this.setDeptName((String) obj.get("deptName"));
		}
		if (obj.get("siteName") instanceof String) {
			this.setSiteName((String) obj.get("siteName"));
		}
		if (obj.get("siteAdd") instanceof String) {
			this.setSiteAdd((String) obj.get("siteAdd"));
		}
		if (obj.get("siteDesc") instanceof String) {
			this.setSiteDesc((String) obj.get("siteDesc"));
		}
		if (obj.get("province") instanceof String) {
			this.setProvince((String) obj.get("province"));
		}
		if (obj.get("city") instanceof String) {
			this.setCity((String) obj.get("city"));
		}
		if (obj.get("siteImg") instanceof String) {
			this.setSiteImg((String) obj.get("siteImg"));
		}
		if (obj.get("businessHours") instanceof String) {
			this.setBusinessHours((String) obj.get("businessHours"));
		}
		if (obj.get("closingTime") instanceof String) {
			this.setClosingTime((String) obj.get("closingTime"));
		}
		if (obj.get("responsible") instanceof String) {
			this.setResponsible((String) obj.get("responsible"));
		}
		if (obj.get("phone") instanceof String) {
			this.setPhone((String) obj.get("phone"));
		}
		if (obj.get("landline") instanceof String) {
			this.setLandline((String) obj.get("landline"));
		}
		if (obj.get("license") instanceof String) {
			this.setLicense((String) obj.get("license"));
		}
		if (obj.get("siteType") instanceof String) {
			this.setSiteType((String) obj.get("siteType"));
		}
		if (obj.get("longitude") instanceof String) {
			this.setLongitude((String) obj.get("longitude"));
		}
		if (obj.get("latitude") instanceof String) {
			this.setLatitude((String) obj.get("latitude"));
		}
		if (obj.get("status") instanceof String) {
			this.setStatus((String) obj.get("status"));
		}
		this.setStartTime((Date) obj.get("startTime"));
		this.setEndTime((Date) obj.get("endTime"));
		this.setCreateTime((Date) obj.get("createTime"));
		this.setUpdateTime((Date) obj.get("updateTime"));
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getDeptId() != null) {
			result.put("deptId",this.getDeptId());
		}
		if (this.getDeptName() != null) {
			result.put("deptName",this.getDeptName());
		}
		if (this.getSiteName() != null) {
			result.put("siteName",this.getSiteName());
		}
		if (this.getSiteAdd() != null) {
			result.put("siteAdd",this.getSiteAdd());
		}
		if (this.getSiteDesc() != null) {
			result.put("siteDesc",this.getSiteDesc());
		}
		if (this.getProvince() != null) {
			result.put("province",this.getProvince());
		}
		if (this.getCity() != null) {
			result.put("city",this.getCity());
		}
		if (this.getSiteImg() != null) {
			result.put("siteImg",this.getSiteImg());
		}
		if (this.getBusinessHours() != null) {
			result.put("businessHours",this.getBusinessHours());
		}
		if (this.getClosingTime() != null) {
			result.put("closingTime",this.getClosingTime());
		}
		if (this.getResponsible() != null) {
			result.put("responsible",this.getResponsible());
		}
		if (this.getPhone() != null) {
			result.put("phone",this.getPhone());
		}
		if (this.getLandline() != null) {
			result.put("landline",this.getLandline());
		}
		if (this.getLicense() != null) {
			result.put("license",this.getLicense());
		}
		if (this.getSiteType() != null) {
			result.put("siteType",this.getSiteType());
		}
		if (this.getLongitude() != null) {
			result.put("longitude",this.getLongitude());
		}
		if (this.getLatitude() != null) {
			result.put("latitude",this.getLatitude());
		}
		if (this.getStatus() != null) {
			result.put("status",this.getStatus());
		}
		if (this.getStartTime() != null) {
			result.put("startTime",this.getStartTime());
		}
		if (this.getEndTime() != null) {
			result.put("endTime",this.getEndTime());
		}
		if (this.getCreateTime() != null) {
			result.put("createTime",this.getCreateTime());
		}
		if (this.getUpdateTime() != null) {
			result.put("updateTime",this.getUpdateTime());
		}
		return result;
	}


	@Override
	public String toString() {
		return "PmsSite [id=" + id + " , deptId=" + deptId + " , deptName=" + deptName + " , siteName=" + siteName + " , siteAdd=" + siteAdd + " , siteDesc=" + siteDesc + " , province=" + province + " , city=" + city + " , siteImg=" + siteImg + " , businessHours=" + businessHours + " , closingTime=" + closingTime + " , responsible=" + responsible + " , phone=" + phone + " , landline=" + landline + " , license=" + license + " , siteType=" + siteType + " , longitude=" + longitude + " , latitude=" + latitude + " , status=" + status + " , startTime=" + startTime + " , endTime=" + endTime + " , createTime=" + createTime + " , updateTime=" + updateTime + "  ]";
	
	}
	
	
}
